home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / 7edit / source / sveditfile.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  16.1 KB  |  715 lines

  1. /*
  2.     File:        SVEditFile.c
  3.  
  4.     Contains:    
  5.  
  6.     Written by: Original version by Jon Lansdell and Nigel Humphreys.
  7.                             3.1 updates by Greg Sutton.    
  8.  
  9.     Copyright:    Copyright ©1995-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 7/19/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. #include <Errors.h>
  25. #include <Resources.h>
  26. #include <Desk.h>
  27. #include <DriverServices.h>
  28. #include <AppleEvents.h>
  29. #include <AERegistry.h>
  30. #include <StandardFile.h>
  31. #include "SVEditFile.h"
  32. #include "Offscreen.h"
  33. #include <TextUtils.h>
  34.  
  35.  
  36.  
  37.  
  38.  
  39. /**-----------------------------------------------------------------------
  40.         Name:             FileError
  41.         Purpose:        Puts up an error alert.
  42.     -----------------------------------------------------------------------**/
  43.  
  44.     
  45. #pragma segment File
  46.  
  47. pascal void FileError(Str255 s, Str255 f)
  48.   {
  49.     short    alertResult;
  50.  
  51.     SetCursor(&qd.arrow);
  52.         ParamText(s, f, (unsigned char *)"", (unsigned char *)"");
  53.     alertResult = Alert(ErrorAlert, nil);
  54.     }
  55.  
  56. /**-----------------------------------------------------------------------
  57.         Name:             DoClose
  58.         Purpose:        Closes a window.
  59.     -----------------------------------------------------------------------**/
  60.  
  61. #pragma segment File
  62.  
  63. pascal OSErr DoClose(WindowPtr aWindow,Boolean canInteract,DescType dialogAnswer)
  64. {
  65.     DPtr    aDocument;
  66.     short   alertResult;
  67.     OSErr   myErr;
  68.                         
  69.     myErr = noErr;
  70.         
  71.     if (gWCount>0)
  72.     {
  73.         aDocument = DPtrFromWindowPtr(aWindow);
  74.             
  75.         if (aDocument->dirty)
  76.             if (canInteract && (dialogAnswer==kAEAsk))
  77.             {
  78.                 alertResult = DoFileDialog ( kSaveDontsaveDialog, aWindow );
  79.                 switch ( alertResult )
  80.                 {
  81.                     case kStdOkItemIndex:
  82.                         if (aDocument->everSaved == false)
  83.                         {
  84.                             myErr = GetFileNameToSaveAs(aDocument);
  85.                             if (myErr == noErr)
  86.                                 myErr = DoSave(aDocument, aDocument->theFSSpec);
  87.                                                                                                     }
  88.                         else
  89.                             myErr = SaveUsingTemp(aDocument);
  90.                     break;
  91.                                                                 
  92.                     case kStdCancelItemIndex:
  93.                         return(userCanceledErr);
  94.                     break;
  95.                     
  96.                     case kDontSaveItemIndex:
  97.                         aDocument->dirty = false;
  98.                     break;
  99.                 }
  100.             }
  101.             else
  102.             {
  103.                 if (dialogAnswer==kAEYes)
  104.                     if (aDocument->everSaved == false)
  105.                     {
  106.                         if (canInteract)
  107.                         {
  108.                             myErr = GetFileNameToSaveAs(aDocument);
  109.                             if (myErr==noErr)
  110.                                 myErr = DoSave(aDocument, aDocument->theFSSpec);
  111.                         }
  112.                         else    
  113.                             return(errAENoUserInteraction);
  114.                     }
  115.                     else
  116.                         myErr = SaveUsingTemp(aDocument);
  117.                 else
  118.                     myErr = noErr; /* Don't save */
  119.             }
  120.                 
  121.             if (myErr==noErr)
  122.             {
  123.                 CloseMyWindow(aWindow);
  124.             }
  125.     }
  126.     else
  127.         myErr = errAEIllegalIndex;
  128.             
  129.     return(myErr);
  130. }
  131.  
  132.  
  133.  
  134. //
  135. // This is called to display the "save before closing" and "revert" dialogs.
  136. //
  137. short DoFileDialog ( short theDlogID, WindowRef theWindow )
  138. {
  139.     short        theItem;
  140.     DialogRef    theDialog;
  141.     WindowRef    dialogWindow;
  142.     DPtr        theDocument;
  143.     Str255        theTitle, theReason;
  144.     
  145.     
  146.     theDocument = DPtrFromWindowPtr ( theWindow );
  147.     
  148.     theDialog = GetNewDialog ( theDlogID, nil, (WindowRef) -1 );
  149.     dialogWindow = GetDialogWindow ( theDialog );
  150.     SetPortWindowPort ( dialogWindow );
  151.     
  152.     
  153.     if ( theDocument->everSaved == false )
  154.         GetWTitle ( theWindow, theTitle );         // Pick it up as a script may have changed it
  155.     else
  156.         PStrCopy ( theTitle, theDocument->theFileName );
  157.  
  158.     if ( gQuitting )
  159.         GetIndString ( theReason, kMiscStrings, kQuittingIndex );
  160.     else
  161.         GetIndString ( theReason, kMiscStrings, kClosingindex );
  162.     
  163.     SetCursor ( &qd.arrow );
  164.     ParamText ( theTitle, theReason, nil, nil );
  165.     ShowWindow ( dialogWindow );
  166.     SelectWindow ( dialogWindow );
  167.     
  168.     SetDialogDefaultItem ( theDialog, kStdOkItemIndex );
  169.     SetDialogCancelItem ( theDialog, kStdCancelItemIndex );
  170.     
  171.     
  172.     // As long as the only enabled items are the dimissers, 
  173.     // there is no need to call ModalDialog within a loop.
  174.     ModalDialog ( nil, &theItem );
  175.     DisposeDialog ( theDialog );
  176.     
  177.     return theItem;
  178. }        
  179.  
  180.  
  181.  
  182. #pragma segment File
  183.  
  184. //  DoQuit
  185. //  saveOpt - one of kAEAsk,kAEYes,kAENo
  186. //  if kAEYes or kAEAsk then AEInteactWithUser should have been called
  187. //  before DoQuit. Assumes that it can interact if it needs to.
  188.  
  189. pascal void DoQuit ( DescType saveOpt )
  190. {
  191.     WindowPtr    aWindow;
  192.     WindowPtr    nextWindow;
  193.     WindowPeek   nextWPeek;
  194.     short        theKind;
  195.     OSErr        check;
  196.     
  197.     aWindow = FrontWindow();
  198.     
  199.     gQuitting = true;
  200.     while ( aWindow )
  201.     {
  202.         nextWPeek  = ((WindowPeek)aWindow)->nextWindow;
  203.         nextWindow = &nextWPeek->port;
  204.         if (Ours(aWindow))
  205.         {
  206.             check = DoClose(aWindow, true, saveOpt);
  207.             if ( check != noErr )
  208.             {
  209.                 gQuitting = false;
  210.                 return;
  211.             }
  212.         }
  213.         else
  214.         {
  215.             theKind = ((WindowPeek)aWindow)->windowKind;
  216.             if (theKind < 0)
  217.                 CloseDeskAcc(theKind);
  218.         }
  219.         aWindow = nextWindow;
  220.     }
  221.     
  222.     return;
  223.     
  224. } // DoQuit
  225.  
  226.  
  227.  
  228. pascal OSErr GetFile(FSSpec *theFSSpec)
  229.   {
  230.     SFTypeList         myTypes;
  231.     StandardFileReply  reply;
  232.  
  233.         myTypes[0] = 'TEXT';
  234.  
  235.         StandardGetFile(nil, 1, myTypes, &reply);
  236.  
  237.         if (reply.sfGood)
  238.             {
  239.                 *theFSSpec = reply.sfFile;
  240.                 return(noErr);
  241.             }
  242.         else
  243.             return(userCanceledErr);
  244.  }
  245.  
  246. #pragma segment File
  247.  
  248.  
  249. pascal OSErr DoCreate(FSSpec theSpec)
  250.   {
  251.       OSErr err;
  252.  
  253.       err = FSpCreate(&theSpec, SVEditAppSig, 'TEXT', smSystemScript);
  254.  
  255.       if (err != noErr)
  256.               ShowError((unsigned char *)"\pDoCreate", err);
  257.                 
  258.             return(err);
  259.     }
  260.  
  261. #pragma segment File
  262.  
  263.  
  264. pascal OSErr WriteFile(DPtr theDocument, short refNum, FSSpec theFSSpec)
  265.   {
  266.     short        resFile;
  267.     long         length;
  268.     HHandle      theHHandle;
  269.     StScrpHandle theSHandle;
  270.     OSErr        err;
  271.     StringHandle theAppName;
  272.     short        oldSelStart;
  273.     short        oldSelEnd;
  274.     Handle       thePHandle;
  275.     Handle       myText;
  276.     
  277.     tWindowOffscreen*    theOffscreen = nil;
  278.  
  279.                 
  280. /*        WriteFile := 1; */
  281.  
  282.     /*first write out the text to the data fork*/
  283.         
  284.         length = (*(theDocument->theText))->teLength;
  285.         
  286.         myText = (*(theDocument->theText))->hText;
  287.         
  288.     HLock(myText);
  289.     
  290.         err = FSWrite(refNum, &length, *myText);
  291.         if (err)
  292.           return(err);
  293.             
  294.     HUnlock(myText);
  295.  
  296.         /*we are writing to a temporary file, so we need to create the resource file*/
  297.         /*before writing out the resources*/
  298.         /*now open the resource file*/
  299.         
  300.         HCreateResFile(theFSSpec.vRefNum, theFSSpec.parID, theFSSpec.name);
  301.         err = ResError();
  302.         if (err)
  303.           {
  304.                 ShowError((unsigned char *)"\pHCreateResFile", err);
  305.                 return(err);
  306.             }
  307.  
  308.     resFile = HOpenResFile(theFSSpec.vRefNum, theFSSpec.parID, theFSSpec.name, fsWrPerm);
  309.     err = ResError();
  310.  
  311.     if (err)
  312.           {
  313.                 ShowError((unsigned char *)"\pHOpenResFile", err);
  314.                 return(err);
  315.             }
  316.  
  317.      /*write out our 'TFSF' resource to file*/
  318.      
  319.      //    Draw everything into offscreen pixmap.
  320.     theOffscreen = DrawOffscreen ( theDocument->theWindow );
  321.     if ( theOffscreen  )
  322.         (*theDocument->theText)->inPort = (GrafPtr) theOffscreen->offscreenWorld;
  323.     
  324.     
  325.     oldSelStart = (*(theDocument->theText))->selStart;
  326.     oldSelEnd   = (*(theDocument->theText))->selEnd;
  327.     TESetSelect(0,32000, theDocument->theText);
  328.     
  329.     theSHandle = TEGetStyleScrapHandle(theDocument->theText);
  330.     
  331.     TESetSelect(oldSelStart,oldSelEnd, theDocument->theText);
  332.     
  333.     
  334.     if ( theOffscreen )
  335.     {
  336.         // If it wasn't for the caret, we wouldn't need to draw this
  337.         theOffscreen = DrawOnscreen ( theOffscreen );
  338.         (*theDocument->theText)->inPort = theDocument->theWindow;
  339.     }
  340.     
  341.     AddResource((Handle)theSHandle, 'TFSF', 255, (unsigned char *)"\pStyle Info");
  342.     err = ResError();
  343.     if (err)
  344.           {
  345.                 ShowError((unsigned char *)"\pAddResource- TFSF", err);
  346.                 return(err);
  347.             }
  348.                     
  349. // write out the printer info
  350.                 
  351.     // First the QD info
  352.                 
  353.         if (theDocument->thePrintSetup)
  354.             {
  355.                 thePHandle = (Handle)theDocument->thePrintSetup;
  356.                 err = HandToHand(&thePHandle);
  357.                 
  358.                 AddResource(thePHandle, 'TFSP', 255, (unsigned char *)"\pPrinter Info");
  359.                 err = ResError();
  360.                 if (err)
  361.                     {
  362.                         ShowError((unsigned char *)"\pAddResource- TFSP", err);
  363.                         return(err);
  364.                     }
  365.             }
  366.                 
  367.                 
  368.         theHHandle = (HHandle)NewHandle(sizeof(HeaderRec));
  369.     HLock((Handle)theHHandle);
  370.  
  371.         GetFontName(theDocument->theFont, (unsigned char *)&(*theHHandle)->theFont);
  372.         (*theHHandle)->theSize     = theDocument->theSize;
  373.         (*theHHandle)->theStyle    = theDocument->theStyle;
  374.         (*theHHandle)->lastID      = theDocument->lastID;
  375.  
  376.         HUnlock((Handle)theHHandle);
  377.  
  378.         AddResource((Handle)theHHandle, 'TFSS', 255, (unsigned char *)"\pHeader Info");
  379.  
  380.         err = ResError();
  381.         if (err)
  382.             {
  383.                 ShowError((unsigned char *)"\pAddResource- TFSS", err);
  384.                 return(err);
  385.             }
  386.  
  387.         /*if we have any sections, write out the records and resources*/
  388.         
  389.         /*Now put an AppName in for Finder in 7.0*/
  390.  
  391.         theAppName = (StringHandle)NewHandle(6);
  392.         PStrCopy(*theAppName,(unsigned char *)"\p7Edit");
  393.         
  394.         AddResource((Handle)theAppName, 'STR ', - 16396, (unsigned char *)"\pFinder App Info");
  395.  
  396.         err = ResError();
  397.  
  398.         if (err)
  399.             {
  400.                 ShowError((unsigned char *)"\pAppName", err);
  401.                 return(err);
  402.             }
  403.  
  404.         CloseResFile(resFile);
  405.  
  406.         return(noErr);
  407.     } /* WriteFile */
  408.  
  409. #pragma segment File
  410.  
  411. pascal OSErr ReadFile(DPtr theDocument, short  refNum, Str255 fn)
  412.  {
  413.         long            theSize;
  414.         short           resFile;
  415.         OSErr           err;
  416.         HHandle         aHandle;
  417.         Handle          gHandle;
  418.         Boolean         gotQDPrintRec;
  419.         
  420.         gotQDPrintRec = false;
  421.  
  422.         err = GetEOF(refNum, &theSize);
  423.                 if (err)
  424.           return(err);
  425.  
  426.         /*we're only using TE, so check that there is not more than 32K worth of text*/
  427.                 
  428.         if (theSize > 32000)
  429.           return(1);
  430.  
  431.         gHandle = NewHandle(theSize);
  432.         HLock(gHandle);
  433.                 err = FSRead(refNum, &theSize, *gHandle);
  434.                 
  435.         if (err)
  436.           {
  437.             HUnlock(gHandle);
  438.                         return(err);
  439.           }
  440.                                 
  441.                 resFile = HOpenResFile(theDocument->theFSSpec.vRefNum, 
  442.                                                              theDocument->theFSSpec.parID,
  443.                                                              fn,
  444.                                                              fsWrPerm);
  445.                 if (resFile == -1)
  446.                     err = fnfErr;
  447.                     
  448.                 if (err==noErr)
  449.                     {
  450.                         aHandle = nil;
  451.         
  452.                         if (Count1Resources('TFSS'))
  453.                             aHandle = (HHandle)Get1Resource('TFSS', 255);
  454.                         /*
  455.                             New Format Info
  456.                         */
  457.                         
  458.                         aHandle = nil;
  459.                         
  460.                         if (Count1Resources('TFSF'))
  461.                             aHandle = (HHandle)Get1Resource('TFSF', 255);
  462.                             
  463.                         HLock(gHandle);
  464.                         TEStyleInsert(    *gHandle,
  465.                                                     GetHandleSize(gHandle),
  466.                                                     (StScrpHandle)aHandle,
  467.                                                     theDocument->theText);
  468.                                         
  469.                         HUnlock(gHandle);
  470.                         
  471.                         /*
  472.                             If there is a print record saved, ditch the old one
  473.                             created by new document and fill this one in
  474.                         */
  475.                         if (Count1Resources('TFSP'))
  476.                         {
  477.                             if (theDocument->thePrintSetup)
  478.                                 DisposeHandle((Handle)theDocument->thePrintSetup);
  479.                             
  480.                             theDocument->thePrintSetup = (THPrint)Get1Resource('TFSP', 255);
  481.                               err = HandToHand((Handle *)&theDocument->thePrintSetup);
  482.                             
  483.                             gotQDPrintRec = true;
  484.             
  485.                         }
  486.  
  487.                         CloseResFile(resFile);
  488.         
  489.                         err = ResError();
  490.                         if (err)
  491.                             {
  492.                                 ShowError((unsigned char *)"\pread file- CloseResFile", err);
  493.                                 return(err);
  494.                             }
  495.           }
  496.                 else
  497.                     TESetText(*gHandle, 
  498.                               GetHandleSize(gHandle), 
  499.                                         theDocument->theText);
  500.                     
  501.                 if (gHandle)
  502.                     DisposeHandle(gHandle);
  503.                     
  504.                 if (err==fnfErr)
  505.                     err = noErr;
  506.  
  507.         return(err);
  508.         } /* ReadFile */
  509.  
  510. /** -----------------------------------------------------------------------
  511.         Name:             GetFileContents
  512.         Purpose:        Opens the document specified by theFSSpec and puts
  513.                                 the contents into theDocument.
  514.      -----------------------------------------------------------------------**/
  515.  
  516.     
  517. #pragma segment File
  518.  
  519. pascal OSErr GetFileContents(FSSpec theFSSpec, DPtr theDocument)
  520.   {
  521.      OSErr            err;
  522.      short            theRefNum;
  523.  
  524.             /*this can be called from two places- on an OpenDoc AppleEvent*/
  525.             /*and by the user just selecting Open from the File Menu*/
  526.             /*assume that the CFS is correct when the routine is called*/
  527.  
  528.             err = FSpOpenDF(&theFSSpec,
  529.                                           fsRdWrPerm,
  530.                                           &theRefNum);
  531.             if (err)
  532.                 {
  533.                     ShowError((unsigned char *)"\pFSpOpenDF", err);
  534.                     return(err);
  535.                 }
  536.             else
  537.                 {
  538.                     err = ReadFile(theDocument, theRefNum, theFSSpec.name);
  539.                     if (err)
  540.                         {
  541.                             ShowError((unsigned char *)"\pReadFile", err);
  542.                             return(err);
  543.                         }
  544.                     err=FSClose(theRefNum);
  545.                     if (err)
  546.                         {
  547.                             ShowError((unsigned char *)"\pFSClose", err);
  548.                             return(err);
  549.                         }
  550.                     return(noErr);
  551.                 }
  552.         }
  553.  
  554.     
  555. #pragma segment File
  556.  
  557. pascal OSErr SaveUsingTemp(DPtr theDocument)
  558.   {
  559.     Str255           tempName;
  560.     OSErr            err;
  561.         FSSpec                tempFSSpec;
  562.  
  563.         /*save the file to disk using a temporary file*/
  564.         /*this is the recommended way of doing things*/
  565.         /*first write out the file to disk using a temporary filename*/
  566.         /*if it is sucessfully written, exchange the temporary file with the last one saved*/
  567.     /*then delete the temporary file- so if anything goes wrong, the original version is still there*/
  568.         /*first generate the temporary filename*/
  569.  
  570.         GetTempFileName(theDocument, tempName);
  571.         /*create this file on disk*/
  572.  
  573.         tempFSSpec      = theDocument->theFSSpec;
  574.         PStrCopy(tempFSSpec.name,tempName);
  575.             
  576.         err = DoCreate(tempFSSpec);    
  577.  
  578.         /*now save the file as normal*/
  579.         
  580.         if (err==noErr)
  581.             err = DoSave(theDocument, tempFSSpec);
  582.         
  583.         if (err == noErr)
  584.             err = FSpExchangeFiles(&tempFSSpec, &theDocument->theFSSpec);
  585.  
  586.         /*we've exchanged the files, now delete the temporary one*/
  587.         
  588.         if (err==noErr)
  589.           err = FSpDelete(&tempFSSpec);
  590.  
  591.         return(err);
  592.     }
  593.  
  594.     
  595. #pragma segment File
  596.  
  597. /*
  598.     Fills in the document record with the user chosen destination
  599. */
  600.  
  601. pascal OSErr GetFileNameToSaveAs(DPtr theDocument)
  602.     {            
  603.     StandardFileReply   reply;
  604.     OSErr               err;
  605.         Str255              suggestName;
  606.  
  607.         GetWTitle(theDocument->theWindow, suggestName);
  608.  
  609.         StandardPutFile((unsigned char *)"\pSave Document As:", suggestName, &reply);
  610.  
  611.     if (reply.sfGood)
  612.             {                
  613.                 err = FSpDelete(&reply.sfFile);
  614.                 
  615.                 if (!((err==noErr) || (err==fnfErr)))
  616.                     return(err);
  617.                 else
  618.                     err = noErr;
  619.                     
  620.                 theDocument->theFSSpec = reply.sfFile;
  621.                 PStrCopy(theDocument->theFileName, reply.sfFile.name);
  622.             }
  623.         else
  624.             err = userCanceledErr;
  625.         
  626.         return(err);
  627.  } /* GetFileNameToSaveAs */
  628.  
  629.     
  630. #pragma segment File
  631.  
  632. pascal OSErr DoSave(DPtr   theDocument, FSSpec theFSSpec)
  633.   {
  634.     short      refNum;
  635.     OSErr      fileErr;
  636.  
  637.         fileErr = FSpOpenDF(&theFSSpec, fsRdWrPerm, &refNum);
  638.         
  639.         if (fileErr == fnfErr)
  640.             {
  641.               fileErr = DoCreate(theFSSpec);
  642.                 
  643.                 if (fileErr)
  644.                     return(fileErr);
  645.                     
  646.                 fileErr = FSpOpenDF(&theFSSpec, fsRdWrPerm, &refNum);
  647.             }
  648.  
  649.         if (fileErr == noErr)
  650.             {
  651.               fileErr = WriteFile(theDocument, refNum, theFSSpec);
  652.                 
  653.                 if (fileErr==noErr)
  654.                     theDocument->dirty = false;
  655.                     
  656.                 fileErr = FSClose(refNum);
  657.             }
  658.         else
  659.             FileError((unsigned char *)"\perror opening file ", theFSSpec.name);
  660.         
  661.         return(fileErr);
  662.     }
  663.  
  664.     
  665. #pragma segment File
  666.  
  667. pascal OSErr OpenOld(FSSpec aFSSpec)
  668.     {        
  669.       DPtr  theDocument;
  670.         OSErr fileErr;
  671.  
  672.         theDocument = NewDocument(true, (WindowPtr)-1L);
  673.         
  674.         SetWTitle(theDocument->theWindow, aFSSpec.name);
  675.         
  676.         SetPort(theDocument->theWindow);
  677.         
  678.         theDocument->theFSSpec   = aFSSpec;
  679.         
  680.         PStrCopy(theDocument->theFileName,aFSSpec.name);
  681.         
  682.         theDocument->dirty       = false;
  683.         theDocument->everSaved   = true;
  684.  
  685.     fileErr = GetFileContents(aFSSpec, theDocument);
  686.         
  687.         if (fileErr == noErr)
  688.             {
  689.                 DoResizeWindow(theDocument);
  690.                 ShowWindow(theDocument->theWindow);
  691.             }
  692.         else
  693.             FileError((unsigned char *)"\pError Opening ", aFSSpec.name);
  694.                     
  695.         return(fileErr);
  696.     } /* OpenOld */
  697.  
  698.     
  699. #pragma segment File
  700.  
  701. pascal OSErr OpenUsingAlias(AliasHandle theAliasH)
  702.   {
  703.     OSErr    err;
  704.     FSSpec   aFSSpec;
  705.     Boolean  dummy;
  706.  
  707.         err = ResolveAlias(nil, theAliasH, &aFSSpec, &dummy);
  708.         
  709.         if (err == noErr)
  710.             err = OpenOld(aFSSpec);
  711.                     
  712.         return(err);
  713.     }
  714.  
  715.